<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h1 v-if="showName">{{fullName}}</h1>
      <button @click="firstName='abc', showName = !showName">toggle</button>
    </div>
    <script src="./vue.js"></script>
    <script>
      var vm = new Vue({
        el: "#app",
        data: {
          firstName: "yuan",
          lastName: "jin",
          showName: true,
        },
        computed: {
          fullName: {
            get() {
              console.log("getter");
              return this.firstName + this.lastName;
            },
            set(val) {
              var parts = val.split(" ");
              this.firstName = parts[0];
              this.lastName = parts[1];
            },
          },
        },
        methods: {
          a() {},
          b(...args) {},
        },
      });
      console.log(vm);
    </script>
  </body>
</html>

